#pragma once

#include "common.h"

struct RamInfo
{
	u64 physMemFree;
	u64 physMemTotal;
	u64 pageFileFree;
	u64 pageFileTotal;
	u64 virtualMemFree;
	u64 virtualMemTotal;
};

//Provides funtcions to operate on RAM.
//Gives information about computer memory.
class SysRam
{
public:
	RamInfo GetMemoryInfo();
};

inline RamInfo SysRam::GetMemoryInfo()
{
	RamInfo info;
	MEMORYSTATUSEX memStatus;
	memStatus.dwLength = sizeof(memStatus);

	GlobalMemoryStatusEx(&memStatus);

	info.physMemFree = memStatus.ullAvailPhys/1024;;
	info.physMemTotal = memStatus.ullTotalPhys/1024;
	info.pageFileFree = memStatus.ullAvailPageFile/1024;
	info.pageFileTotal = memStatus.ullTotalPageFile/1024;
	info.virtualMemFree = memStatus.ullAvailVirtual/1024;
	info.virtualMemTotal = memStatus.ullTotalVirtual/1024;

	return info;
}